/**
 * Captain
 * © 2018 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * 
 * JAVA : 8
 * 文  件  名: AppraiseController.java
 * 创  建  人: QinYoubin (qin.youbin@sccaptain.com.cn)
 * 创建时间: 2018年5月3日 上午11:25:29
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */
package com.material.c2c.web.message.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cpt.framework.web.JsonResult;
import com.material.c2c.message.entity.YHPL;
import com.material.c2c.message.model.OrderMessageDTO;
import com.material.c2c.message.service.AppraiseService;
import com.material.c2c.web.user.model.QueryVO;
import com.material.c2c.web.util.ControllerUtil;

/**
 * 用户评论
 * @since 1.0
 * @version 1.0
 * @author QinYoubin (qin.youbin@sccaptain.com.cn)
 */
@RestController
@RequestMapping("/appraise")
public class AppraiseController {
  @Resource
  private AppraiseService appraiseService;
  
  @PostMapping("/add")
  public JsonResult add(@RequestBody YHPL yhpl) {
    return ControllerUtil.getResult(appraiseService.add(yhpl));
  }
  @PostMapping("/update")
  public JsonResult update(@RequestBody YHPL yhpl) {
    return ControllerUtil.getResult(appraiseService.add(yhpl));
  }
  @GetMapping("/delete/{id}")
  public JsonResult delete(@PathVariable String id) {
    return ControllerUtil.getResult(appraiseService.delete(id));
  }
  @PostMapping("/page")
  public JsonResult page(@RequestBody QueryVO vo) {
    return JsonResult.success(appraiseService.page(vo.getKey(), vo.getPageable()));
  }
  @GetMapping("/top5/{id}")
  public JsonResult top5(@PathVariable String id) {
    return JsonResult.success(appraiseService.top5(id));
  }
  @PostMapping("/saveOrderAppraise")
  public JsonResult saveOrderAppraise(@RequestBody OrderMessageDTO dto) {
	  return ControllerUtil.getResult(appraiseService.saveOrderAppraise(dto));
  } 
}
